@page "{id:int?}"
@model ModelBindingSample.Pages.Instructors.IndexModel

@{
    ViewData["Title"] = "Instructors";
}

<h2>Instructors</h2>

<p>Application Insights cookie = @Model.ApplicationInsightsCookie</p>
<p>Language = @ViewData["Language"]</p>

<p>
    <a href="/Instructors/Create?note=ThisIsFromTheQueryString" >Create New</a>
</p>
<table class="table">
    <thead>
        <tr>
            <th>Last Name</th>
            <th>First Name</th>
            <th>Hire Date</th>
            <th>Office</th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model.Instructors)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.LastName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.FirstMidName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.HireDate)
                </td>
                <td>
                    @if (item.OfficeAssignment != null)
                    {
                        @item.OfficeAssignment.Location
                    }
                </td>
                <td>
                    <a asp-page="./Edit" asp-route-id="@item.ID">Edit</a>
                </td>
            </tr>
        }
    </tbody>
</table>
